require.config({
    baseUrl: 'src/lib',
    paths: {
        'app': '../..',
        'domReady': 'require/domReady',
        'text': 'require/text',
        'jquery': 'jquery/jquery',
        'placeholder': 'jquery/jquery.placeholder.min',

        'knockout': 'knockout/knockout',
        'knockout.mapping': 'knockout/knockout.mapping',
        'knockout.validation': 'knockout/knockout.validation',
        'knockout.validation.zh-CN': 'knockout/zh-CN',
        'knockout.amd': 'knockout/knockout-amd-helpers',

        'moment': 'moment/moment',
        'moment.zh-cn': 'moment/zh-cn',

        'perfect.scrollbar.jquery': 'perfect-scrollbar/js/perfect-scrollbar.jquery.min',
        'perfect.scrollbar': 'perfect-scrollbar/js/perfect-scrollbar.min',
        'art.dialog': 'artDialog/dialog-plus.min',

        'jquery.cookie': 'jquery/jquery.cookie',
        'jquery.crypto.core': 'crypto/core-min',
        'jquery.crypto.enc.base64': 'crypto/enc-base64-min',

        'datetimepicker': 'datetimepicker/jquery.datetimepicker.full.min',

        'hr.common': '../hr/hr.common',
        'config': 'config'
        //'dialog':'dist/js/lib/artdialog/dialog-plus',
        //

        //
        //'common': 'src/common',
        //'knockout.common': 'src/ko.common',
        //
        //'placeholder': 'dist/js/lib/jquery/jquery.placeholder.min',
        //'config': 'src/config'
    },
    shim: {
        //'knockout.validation': {
        //    deps: ['knockout']
        //},
        //'knockout.amd': {
        //    deps: ['text', 'knockout']
        //},
        'jquery.crypto.enc.base64': {
            deps: ['jquery', 'jquery.cookie', 'jquery.crypto.core']
        },
        //'knockout.common': {
        //    deps: ['knockout']
        //},

        // 'hr.openLayer': {
        //    deps: ['hr.openLayer']
        // }

        //'perfect.scrollbar.jquery': {
        //    deps: ['jquery']
        //},
        //'perfect.scrollbar': {
        //    deps: ['perfect.scrollbar.jquery']
        //},
        //'placeholder': {
        //    deps: ['jquery']
        //}
        'datetimepicker': {
            deps: ['jquery']
        }
    },
    deps: ['knockout', 'knockout.mapping'],
    callback: function (ko, koMapping) {
        ko.mapping = koMapping;
    }
});

define('init', function (require) {
    require('jquery');  // 默认就有全局的$和jQuery变量
    window.ko = require('knockout');
    window.moment = require('moment');
    window.dialog = require('art.dialog');

    require('knockout.mapping');
    require('knockout.validation');
    require('knockout.validation.zh-CN');
    require('knockout.amd');
    require('moment.zh-cn');
    require('perfect.scrollbar.jquery');
    //
    require('jquery.cookie');
    require('jquery.crypto.core');
    require('jquery.crypto.enc.base64');

    require('../hr/ko.common');
    // require('koValidation/zh-CN');
    // require('perfect.scrollbar');
    //require('placeholder');
    require('datetimepicker');
    //设置datatimepicker语言
    $.datetimepicker.setLocale('ch');
    //
    // 配置项
    ko.validation.init({
        registerExtenders: true,
        messagesOnModified: true,
        insertMessages: true,
        decorateInputElement: true,
        errorElementClass: 'u-input-false'
    }, true);
    ko.validation.locale('zh-CN');
    moment.locale('zh-cn');
    ko.amdTemplateEngine.defaultPath = '../';
    ko.bindingHandlers.module.baseDir = '../';
    ko.common.templatePath = './hr/';
});

define(['domReady!', 'init'], function () {
    var vm = {
        initPage: ko.observable('app/index/index'),
        currentMenu: ko.observable({menuUrl: ''})
    };
    ko.applyBindings(vm);
    return vm;
});